3.1.43 \(\int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx\) [43]

3.1.43.1 Optimal result
3.1.43.2 Mathematica [B] (warning: unable to verify)
3.1.43.3 Rubi [A] (verified)
3.1.43.4 Maple [B] (verified)
3.1.43.5 Fricas [B] (verification not implemented)
3.1.43.6 Sympy [F]
3.1.43.7 Maxima [B] (verification not implemented)
3.1.43.8 Giac [F]
3.1.43.9 Mupad [F(-1)]

3.1.43.1 Optimal result

Integrand size = 20, antiderivative size = 227 \[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=-\frac {i b^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {2 i a b (c+d x)^3}{3 d}-\frac {b^2 (c+d x)^3}{3 d}-\frac {b^2 (c+d x)^2 \cot (e+f x)}{f}+\frac {2 b^2 d (c+d x) \log \left (1-e^{2 i (e+f x)}\right )}{f^2}+\frac {2 a b (c+d x)^2 \log \left (1-e^{2 i (e+f x)}\right )}{f}-\frac {i b^2 d^2 \operatorname {PolyLog}\left (2,e^{2 i (e+f x)}\right )}{f^3}-\frac {2 i a b d (c+d x) \operatorname {PolyLog}\left (2,e^{2 i (e+f x)}\right )}{f^2}+\frac {a b d^2 \operatorname {PolyLog}\left (3,e^{2 i (e+f x)}\right )}{f^3} \]

output
-I*b^2*(d*x+c)^2/f+1/3*a^2*(d*x+c)^3/d-2/3*I*a*b*(d*x+c)^3/d-1/3*b^2*(d*x+ 
c)^3/d-b^2*(d*x+c)^2*cot(f*x+e)/f+2*b^2*d*(d*x+c)*ln(1-exp(2*I*(f*x+e)))/f 
^2+2*a*b*(d*x+c)^2*ln(1-exp(2*I*(f*x+e)))/f-I*b^2*d^2*polylog(2,exp(2*I*(f 
*x+e)))/f^3-2*I*a*b*d*(d*x+c)*polylog(2,exp(2*I*(f*x+e)))/f^2+a*b*d^2*poly 
log(3,exp(2*I*(f*x+e)))/f^3
 
3.1.43.2 Mathematica [B] (warning: unable to verify)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(737\) vs. \(2(227)=454\).

Time = 7.15 (sec) , antiderivative size = 737, normalized size of antiderivative = 3.25 \[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=-\frac {a b d^2 e^{i e} \csc (e) \left (2 e^{-2 i e} f^3 x^3+3 i \left (1-e^{-2 i e}\right ) f^2 x^2 \log \left (1-e^{-i (e+f x)}\right )+3 i \left (1-e^{-2 i e}\right ) f^2 x^2 \log \left (1+e^{-i (e+f x)}\right )-6 \left (1-e^{-2 i e}\right ) f x \operatorname {PolyLog}\left (2,-e^{-i (e+f x)}\right )-6 \left (1-e^{-2 i e}\right ) f x \operatorname {PolyLog}\left (2,e^{-i (e+f x)}\right )+6 i \left (1-e^{-2 i e}\right ) \operatorname {PolyLog}\left (3,-e^{-i (e+f x)}\right )+6 i \left (1-e^{-2 i e}\right ) \operatorname {PolyLog}\left (3,e^{-i (e+f x)}\right )\right )}{3 f^3}+\frac {1}{3} x \left (3 c^2+3 c d x+d^2 x^2\right ) \csc (e) \left (2 a b \cos (e)+a^2 \sin (e)-b^2 \sin (e)\right )+\frac {2 b^2 c d \csc (e) (-f x \cos (e)+\log (\cos (f x) \sin (e)+\cos (e) \sin (f x)) \sin (e))}{f^2 \left (\cos ^2(e)+\sin ^2(e)\right )}+\frac {2 a b c^2 \csc (e) (-f x \cos (e)+\log (\cos (f x) \sin (e)+\cos (e) \sin (f x)) \sin (e))}{f \left (\cos ^2(e)+\sin ^2(e)\right )}+\frac {\csc (e) \csc (e+f x) \left (b^2 c^2 \sin (f x)+2 b^2 c d x \sin (f x)+b^2 d^2 x^2 \sin (f x)\right )}{f}-\frac {b^2 d^2 \csc (e) \sec (e) \left (e^{i \arctan (\tan (e))} f^2 x^2+\frac {\left (i f x (-\pi +2 \arctan (\tan (e)))-\pi \log \left (1+e^{-2 i f x}\right )-2 (f x+\arctan (\tan (e))) \log \left (1-e^{2 i (f x+\arctan (\tan (e)))}\right )+\pi \log (\cos (f x))+2 \arctan (\tan (e)) \log (\sin (f x+\arctan (\tan (e))))+i \operatorname {PolyLog}\left (2,e^{2 i (f x+\arctan (\tan (e)))}\right )\right ) \tan (e)}{\sqrt {1+\tan ^2(e)}}\right )}{f^3 \sqrt {\sec ^2(e) \left (\cos ^2(e)+\sin ^2(e)\right )}}-\frac {2 a b c d \csc (e) \sec (e) \left (e^{i \arctan (\tan (e))} f^2 x^2+\frac {\left (i f x (-\pi +2 \arctan (\tan (e)))-\pi \log \left (1+e^{-2 i f x}\right )-2 (f x+\arctan (\tan (e))) \log \left (1-e^{2 i (f x+\arctan (\tan (e)))}\right )+\pi \log (\cos (f x))+2 \arctan (\tan (e)) \log (\sin (f x+\arctan (\tan (e))))+i \operatorname {PolyLog}\left (2,e^{2 i (f x+\arctan (\tan (e)))}\right )\right ) \tan (e)}{\sqrt {1+\tan ^2(e)}}\right )}{f^2 \sqrt {\sec ^2(e) \left (\cos ^2(e)+\sin ^2(e)\right )}} \]

input
Integrate[(c + d*x)^2*(a + b*Cot[e + f*x])^2,x]
 
output
-1/3*(a*b*d^2*E^(I*e)*Csc[e]*((2*f^3*x^3)/E^((2*I)*e) + (3*I)*(1 - E^((-2* 
I)*e))*f^2*x^2*Log[1 - E^((-I)*(e + f*x))] + (3*I)*(1 - E^((-2*I)*e))*f^2* 
x^2*Log[1 + E^((-I)*(e + f*x))] - 6*(1 - E^((-2*I)*e))*f*x*PolyLog[2, -E^( 
(-I)*(e + f*x))] - 6*(1 - E^((-2*I)*e))*f*x*PolyLog[2, E^((-I)*(e + f*x))] 
 + (6*I)*(1 - E^((-2*I)*e))*PolyLog[3, -E^((-I)*(e + f*x))] + (6*I)*(1 - E 
^((-2*I)*e))*PolyLog[3, E^((-I)*(e + f*x))]))/f^3 + (x*(3*c^2 + 3*c*d*x + 
d^2*x^2)*Csc[e]*(2*a*b*Cos[e] + a^2*Sin[e] - b^2*Sin[e]))/3 + (2*b^2*c*d*C 
sc[e]*(-(f*x*Cos[e]) + Log[Cos[f*x]*Sin[e] + Cos[e]*Sin[f*x]]*Sin[e]))/(f^ 
2*(Cos[e]^2 + Sin[e]^2)) + (2*a*b*c^2*Csc[e]*(-(f*x*Cos[e]) + Log[Cos[f*x] 
*Sin[e] + Cos[e]*Sin[f*x]]*Sin[e]))/(f*(Cos[e]^2 + Sin[e]^2)) + (Csc[e]*Cs 
c[e + f*x]*(b^2*c^2*Sin[f*x] + 2*b^2*c*d*x*Sin[f*x] + b^2*d^2*x^2*Sin[f*x] 
))/f - (b^2*d^2*Csc[e]*Sec[e]*(E^(I*ArcTan[Tan[e]])*f^2*x^2 + ((I*f*x*(-Pi 
 + 2*ArcTan[Tan[e]]) - Pi*Log[1 + E^((-2*I)*f*x)] - 2*(f*x + ArcTan[Tan[e] 
])*Log[1 - E^((2*I)*(f*x + ArcTan[Tan[e]]))] + Pi*Log[Cos[f*x]] + 2*ArcTan 
[Tan[e]]*Log[Sin[f*x + ArcTan[Tan[e]]]] + I*PolyLog[2, E^((2*I)*(f*x + Arc 
Tan[Tan[e]]))])*Tan[e])/Sqrt[1 + Tan[e]^2]))/(f^3*Sqrt[Sec[e]^2*(Cos[e]^2 
+ Sin[e]^2)]) - (2*a*b*c*d*Csc[e]*Sec[e]*(E^(I*ArcTan[Tan[e]])*f^2*x^2 + ( 
(I*f*x*(-Pi + 2*ArcTan[Tan[e]]) - Pi*Log[1 + E^((-2*I)*f*x)] - 2*(f*x + Ar 
cTan[Tan[e]])*Log[1 - E^((2*I)*(f*x + ArcTan[Tan[e]]))] + Pi*Log[Cos[f*x]] 
 + 2*ArcTan[Tan[e]]*Log[Sin[f*x + ArcTan[Tan[e]]]] + I*PolyLog[2, E^((2...
 
3.1.43.3 Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 227, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {3042, 4205, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c+d x)^2 \left (a-b \tan \left (e+f x+\frac {\pi }{2}\right )\right )^2dx\)

\(\Big \downarrow \) 4205

\(\displaystyle \int \left (a^2 (c+d x)^2+2 a b (c+d x)^2 \cot (e+f x)+b^2 (c+d x)^2 \cot ^2(e+f x)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^2 (c+d x)^3}{3 d}-\frac {2 i a b d (c+d x) \operatorname {PolyLog}\left (2,e^{2 i (e+f x)}\right )}{f^2}+\frac {2 a b (c+d x)^2 \log \left (1-e^{2 i (e+f x)}\right )}{f}-\frac {2 i a b (c+d x)^3}{3 d}+\frac {a b d^2 \operatorname {PolyLog}\left (3,e^{2 i (e+f x)}\right )}{f^3}+\frac {2 b^2 d (c+d x) \log \left (1-e^{2 i (e+f x)}\right )}{f^2}-\frac {b^2 (c+d x)^2 \cot (e+f x)}{f}-\frac {i b^2 (c+d x)^2}{f}-\frac {b^2 (c+d x)^3}{3 d}-\frac {i b^2 d^2 \operatorname {PolyLog}\left (2,e^{2 i (e+f x)}\right )}{f^3}\)

input
Int[(c + d*x)^2*(a + b*Cot[e + f*x])^2,x]
 
output
((-I)*b^2*(c + d*x)^2)/f + (a^2*(c + d*x)^3)/(3*d) - (((2*I)/3)*a*b*(c + d 
*x)^3)/d - (b^2*(c + d*x)^3)/(3*d) - (b^2*(c + d*x)^2*Cot[e + f*x])/f + (2 
*b^2*d*(c + d*x)*Log[1 - E^((2*I)*(e + f*x))])/f^2 + (2*a*b*(c + d*x)^2*Lo 
g[1 - E^((2*I)*(e + f*x))])/f - (I*b^2*d^2*PolyLog[2, E^((2*I)*(e + f*x))] 
)/f^3 - ((2*I)*a*b*d*(c + d*x)*PolyLog[2, E^((2*I)*(e + f*x))])/f^2 + (a*b 
*d^2*PolyLog[3, E^((2*I)*(e + f*x))])/f^3
 

3.1.43.3.1 Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4205
Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 
3.1.43.4 Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 931 vs. \(2 (207 ) = 414\).

Time = 0.80 (sec) , antiderivative size = 932, normalized size of antiderivative = 4.11

method result size
risch \(\text {Expression too large to display}\) \(932\)

input
int((d*x+c)^2*(a+b*cot(f*x+e))^2,x,method=_RETURNVERBOSE)
 
output
d*a^2*c*x^2+a^2*c^2*x-d*b^2*c*x^2+4/f^3*b^2*e*d^2*ln(exp(I*(f*x+e)))-2/f^3 
*b^2*e*d^2*ln(exp(I*(f*x+e))-1)+2/f*b*a*c^2*ln(exp(I*(f*x+e))+1)-4/f*b*a*c 
^2*ln(exp(I*(f*x+e)))+2/f*b*a*c^2*ln(exp(I*(f*x+e))-1)+2/f^2*b^2*c*d*ln(ex 
p(I*(f*x+e))+1)-4/f^2*b^2*c*d*ln(exp(I*(f*x+e)))+2/f^2*b^2*c*d*ln(exp(I*(f 
*x+e))-1)+4/f^3*b*a*d^2*polylog(3,exp(I*(f*x+e)))+4/f^3*b*a*d^2*polylog(3, 
-exp(I*(f*x+e)))+2/f^3*b^2*d^2*ln(1-exp(I*(f*x+e)))*e+2/f^2*b^2*d^2*ln(1-e 
xp(I*(f*x+e)))*x+2/f^2*b^2*d^2*ln(exp(I*(f*x+e))+1)*x-2*I/f*b^2*d^2*x^2-2* 
I/f^3*b^2*d^2*e^2-2*I/f^3*b^2*d^2*polylog(2,exp(I*(f*x+e)))-2*I/f^3*b^2*d^ 
2*polylog(2,-exp(I*(f*x+e)))-2/3*I*d^2*a*b*x^3-2*I*b^2*(d^2*x^2+2*c*d*x+c^ 
2)/f/(exp(2*I*(f*x+e))-1)-2/f^3*b*a*d^2*ln(1-exp(I*(f*x+e)))*e^2+2/f*b*a*d 
^2*ln(exp(I*(f*x+e))+1)*x^2+2/f*b*a*d^2*ln(1-exp(I*(f*x+e)))*x^2-4/f^3*b*e 
^2*a*d^2*ln(exp(I*(f*x+e)))+2/f^3*b*e^2*a*d^2*ln(exp(I*(f*x+e))-1)+8/3*I/f 
^3*b*a*d^2*e^3-4*I/f^2*b^2*d^2*e*x-2*I*d*a*b*c*x^2-8*I/f*b*d*c*a*e*x-4*I/f 
^2*b*a*d^2*polylog(2,-exp(I*(f*x+e)))*x+4*I/f^2*b*a*d^2*e^2*x-4*I/f^2*b*a* 
d^2*polylog(2,exp(I*(f*x+e)))*x-4*I/f^2*b*d*c*a*e^2+8/f^2*b*e*a*c*d*ln(exp 
(I*(f*x+e)))-4/f^2*b*e*a*c*d*ln(exp(I*(f*x+e))-1)+4/f*b*d*c*a*ln(1-exp(I*( 
f*x+e)))*x+4/f*b*d*c*a*ln(exp(I*(f*x+e))+1)*x+4/f^2*b*d*c*a*ln(1-exp(I*(f* 
x+e)))*e-4*I/f^2*b*d*c*a*polylog(2,exp(I*(f*x+e)))-4*I/f^2*b*d*c*a*polylog 
(2,-exp(I*(f*x+e)))+2*I*a*b*c^2*x+2/3*I/d*a*b*c^3+1/3*d^2*a^2*x^3+1/3/d*a^ 
2*c^3-1/3*d^2*b^2*x^3-b^2*c^2*x-1/3/d*b^2*c^3
 
3.1.43.5 Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 715 vs. \(2 (201) = 402\).

Time = 0.29 (sec) , antiderivative size = 715, normalized size of antiderivative = 3.15 \[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=-\frac {6 \, b^{2} d^{2} f^{2} x^{2} + 12 \, b^{2} c d f^{2} x + 6 \, b^{2} c^{2} f^{2} - 3 \, a b d^{2} {\rm polylog}\left (3, \cos \left (2 \, f x + 2 \, e\right ) + i \, \sin \left (2 \, f x + 2 \, e\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) - 3 \, a b d^{2} {\rm polylog}\left (3, \cos \left (2 \, f x + 2 \, e\right ) - i \, \sin \left (2 \, f x + 2 \, e\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) + 3 \, {\left (2 i \, a b d^{2} f x + 2 i \, a b c d f + i \, b^{2} d^{2}\right )} {\rm Li}_2\left (\cos \left (2 \, f x + 2 \, e\right ) + i \, \sin \left (2 \, f x + 2 \, e\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) + 3 \, {\left (-2 i \, a b d^{2} f x - 2 i \, a b c d f - i \, b^{2} d^{2}\right )} {\rm Li}_2\left (\cos \left (2 \, f x + 2 \, e\right ) - i \, \sin \left (2 \, f x + 2 \, e\right )\right ) \sin \left (2 \, f x + 2 \, e\right ) - 6 \, {\left (a b d^{2} e^{2} + a b c^{2} f^{2} - b^{2} d^{2} e - {\left (2 \, a b c d e - b^{2} c d\right )} f\right )} \log \left (-\frac {1}{2} \, \cos \left (2 \, f x + 2 \, e\right ) + \frac {1}{2} i \, \sin \left (2 \, f x + 2 \, e\right ) + \frac {1}{2}\right ) \sin \left (2 \, f x + 2 \, e\right ) - 6 \, {\left (a b d^{2} e^{2} + a b c^{2} f^{2} - b^{2} d^{2} e - {\left (2 \, a b c d e - b^{2} c d\right )} f\right )} \log \left (-\frac {1}{2} \, \cos \left (2 \, f x + 2 \, e\right ) - \frac {1}{2} i \, \sin \left (2 \, f x + 2 \, e\right ) + \frac {1}{2}\right ) \sin \left (2 \, f x + 2 \, e\right ) - 6 \, {\left (a b d^{2} f^{2} x^{2} - a b d^{2} e^{2} + 2 \, a b c d e f + b^{2} d^{2} e + {\left (2 \, a b c d f^{2} + b^{2} d^{2} f\right )} x\right )} \log \left (-\cos \left (2 \, f x + 2 \, e\right ) + i \, \sin \left (2 \, f x + 2 \, e\right ) + 1\right ) \sin \left (2 \, f x + 2 \, e\right ) - 6 \, {\left (a b d^{2} f^{2} x^{2} - a b d^{2} e^{2} + 2 \, a b c d e f + b^{2} d^{2} e + {\left (2 \, a b c d f^{2} + b^{2} d^{2} f\right )} x\right )} \log \left (-\cos \left (2 \, f x + 2 \, e\right ) - i \, \sin \left (2 \, f x + 2 \, e\right ) + 1\right ) \sin \left (2 \, f x + 2 \, e\right ) + 6 \, {\left (b^{2} d^{2} f^{2} x^{2} + 2 \, b^{2} c d f^{2} x + b^{2} c^{2} f^{2}\right )} \cos \left (2 \, f x + 2 \, e\right ) - 2 \, {\left ({\left (a^{2} - b^{2}\right )} d^{2} f^{3} x^{3} + 3 \, {\left (a^{2} - b^{2}\right )} c d f^{3} x^{2} + 3 \, {\left (a^{2} - b^{2}\right )} c^{2} f^{3} x\right )} \sin \left (2 \, f x + 2 \, e\right )}{6 \, f^{3} \sin \left (2 \, f x + 2 \, e\right )} \]

input
integrate((d*x+c)^2*(a+b*cot(f*x+e))^2,x, algorithm="fricas")
 
output
-1/6*(6*b^2*d^2*f^2*x^2 + 12*b^2*c*d*f^2*x + 6*b^2*c^2*f^2 - 3*a*b*d^2*pol 
ylog(3, cos(2*f*x + 2*e) + I*sin(2*f*x + 2*e))*sin(2*f*x + 2*e) - 3*a*b*d^ 
2*polylog(3, cos(2*f*x + 2*e) - I*sin(2*f*x + 2*e))*sin(2*f*x + 2*e) + 3*( 
2*I*a*b*d^2*f*x + 2*I*a*b*c*d*f + I*b^2*d^2)*dilog(cos(2*f*x + 2*e) + I*si 
n(2*f*x + 2*e))*sin(2*f*x + 2*e) + 3*(-2*I*a*b*d^2*f*x - 2*I*a*b*c*d*f - I 
*b^2*d^2)*dilog(cos(2*f*x + 2*e) - I*sin(2*f*x + 2*e))*sin(2*f*x + 2*e) - 
6*(a*b*d^2*e^2 + a*b*c^2*f^2 - b^2*d^2*e - (2*a*b*c*d*e - b^2*c*d)*f)*log( 
-1/2*cos(2*f*x + 2*e) + 1/2*I*sin(2*f*x + 2*e) + 1/2)*sin(2*f*x + 2*e) - 6 
*(a*b*d^2*e^2 + a*b*c^2*f^2 - b^2*d^2*e - (2*a*b*c*d*e - b^2*c*d)*f)*log(- 
1/2*cos(2*f*x + 2*e) - 1/2*I*sin(2*f*x + 2*e) + 1/2)*sin(2*f*x + 2*e) - 6* 
(a*b*d^2*f^2*x^2 - a*b*d^2*e^2 + 2*a*b*c*d*e*f + b^2*d^2*e + (2*a*b*c*d*f^ 
2 + b^2*d^2*f)*x)*log(-cos(2*f*x + 2*e) + I*sin(2*f*x + 2*e) + 1)*sin(2*f* 
x + 2*e) - 6*(a*b*d^2*f^2*x^2 - a*b*d^2*e^2 + 2*a*b*c*d*e*f + b^2*d^2*e + 
(2*a*b*c*d*f^2 + b^2*d^2*f)*x)*log(-cos(2*f*x + 2*e) - I*sin(2*f*x + 2*e) 
+ 1)*sin(2*f*x + 2*e) + 6*(b^2*d^2*f^2*x^2 + 2*b^2*c*d*f^2*x + b^2*c^2*f^2 
)*cos(2*f*x + 2*e) - 2*((a^2 - b^2)*d^2*f^3*x^3 + 3*(a^2 - b^2)*c*d*f^3*x^ 
2 + 3*(a^2 - b^2)*c^2*f^3*x)*sin(2*f*x + 2*e))/(f^3*sin(2*f*x + 2*e))
 
3.1.43.6 Sympy [F]

\[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=\int \left (a + b \cot {\left (e + f x \right )}\right )^{2} \left (c + d x\right )^{2}\, dx \]

input
integrate((d*x+c)**2*(a+b*cot(f*x+e))**2,x)
 
output
Integral((a + b*cot(e + f*x))**2*(c + d*x)**2, x)
 
3.1.43.7 Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1948 vs. \(2 (201) = 402\).

Time = 0.59 (sec) , antiderivative size = 1948, normalized size of antiderivative = 8.58 \[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=\text {Too large to display} \]

input
integrate((d*x+c)^2*(a+b*cot(f*x+e))^2,x, algorithm="maxima")
 
output
1/3*(3*(f*x + e)*a^2*c^2 + (f*x + e)^3*a^2*d^2/f^2 - 3*(f*x + e)^2*a^2*d^2 
*e/f^2 + 3*(f*x + e)*a^2*d^2*e^2/f^2 + 3*(f*x + e)^2*a^2*c*d/f - 6*(f*x + 
e)*a^2*c*d*e/f + 6*a*b*c^2*log(sin(f*x + e)) + 6*a*b*d^2*e^2*log(sin(f*x + 
 e))/f^2 - 12*a*b*c*d*e*log(sin(f*x + e))/f + 3*((2*a*b - I*b^2)*(f*x + e) 
^3*d^2 - 6*b^2*d^2*e^2 + 12*b^2*c*d*e*f - 6*b^2*c^2*f^2 - 3*((2*a*b - I*b^ 
2)*d^2*e - (2*a*b - I*b^2)*c*d*f)*(f*x + e)^2 - 3*(I*b^2*d^2*e^2 - 2*I*b^2 
*c*d*e*f + I*b^2*c^2*f^2)*(f*x + e) - 6*((f*x + e)^2*a*b*d^2 - b^2*d^2*e + 
 b^2*c*d*f - (2*a*b*d^2*e - 2*a*b*c*d*f - b^2*d^2)*(f*x + e) - ((f*x + e)^ 
2*a*b*d^2 - b^2*d^2*e + b^2*c*d*f - (2*a*b*d^2*e - 2*a*b*c*d*f - b^2*d^2)* 
(f*x + e))*cos(2*f*x + 2*e) + (-I*(f*x + e)^2*a*b*d^2 + I*b^2*d^2*e - I*b^ 
2*c*d*f + (2*I*a*b*d^2*e - 2*I*a*b*c*d*f - I*b^2*d^2)*(f*x + e))*sin(2*f*x 
 + 2*e))*arctan2(sin(f*x + e), cos(f*x + e) + 1) + 6*(b^2*d^2*e - b^2*c*d* 
f - (b^2*d^2*e - b^2*c*d*f)*cos(2*f*x + 2*e) - (I*b^2*d^2*e - I*b^2*c*d*f) 
*sin(2*f*x + 2*e))*arctan2(sin(f*x + e), cos(f*x + e) - 1) + 6*((f*x + e)^ 
2*a*b*d^2 - (2*a*b*d^2*e - 2*a*b*c*d*f - b^2*d^2)*(f*x + e) - ((f*x + e)^2 
*a*b*d^2 - (2*a*b*d^2*e - 2*a*b*c*d*f - b^2*d^2)*(f*x + e))*cos(2*f*x + 2* 
e) - (I*(f*x + e)^2*a*b*d^2 + (-2*I*a*b*d^2*e + 2*I*a*b*c*d*f + I*b^2*d^2) 
*(f*x + e))*sin(2*f*x + 2*e))*arctan2(sin(f*x + e), -cos(f*x + e) + 1) - ( 
(2*a*b - I*b^2)*(f*x + e)^3*d^2 + 3*(2*b^2*d^2 - (2*a*b - I*b^2)*d^2*e + ( 
2*a*b - I*b^2)*c*d*f)*(f*x + e)^2 + 3*(-I*b^2*d^2*e^2 - I*b^2*c^2*f^2 -...
 
3.1.43.8 Giac [F]

\[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=\int { {\left (d x + c\right )}^{2} {\left (b \cot \left (f x + e\right ) + a\right )}^{2} \,d x } \]

input
integrate((d*x+c)^2*(a+b*cot(f*x+e))^2,x, algorithm="giac")
 
output
integrate((d*x + c)^2*(b*cot(f*x + e) + a)^2, x)
 
3.1.43.9 Mupad [F(-1)]

Timed out. \[ \int (c+d x)^2 (a+b \cot (e+f x))^2 \, dx=\int {\left (a+b\,\mathrm {cot}\left (e+f\,x\right )\right )}^2\,{\left (c+d\,x\right )}^2 \,d x \]

input
int((a + b*cot(e + f*x))^2*(c + d*x)^2,x)
 
output
int((a + b*cot(e + f*x))^2*(c + d*x)^2, x)